<template>
    <cfg-form-list slot="right">
        <cfg-title-prefix v-bind="config.title" :onlyRead="onlyRead" :data="data"></cfg-title-prefix>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: '钼 丝 炉 碳 化 原 始 记 录',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' },
                        config: { type: 'text' }
                    },
                    section: {
                        start: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            cols: 5,
                            columns: [
                                { title: '日期:', key: 'date', config: { type: 'date' } },
                                { title: '炉号:', key: 'FurnaceNo', config: { type: 'text' } },
                                { title: '批号:', key: 'batchNo', config: { type: 'text' } },
                                { title: '班组:', key: 'shift', config: { type: 'select', options: [{ label: 1, value: 1 }, { label: 2, value: 2 }, { label: 1, value: 3 } ] } },
                                { title: '表单号:', key: 'formNo', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: '时间', align: 'center', width: 150, key: 'time', config: { type: 'time' } },
                                { title: '装舟量<br/>(kg/舟)', align: 'center', key: 'weight', config: { type: 'number' } },
                                { title: '推舟速度<br/>(min/舟)', align: 'center', key: 'speed', config: { type: 'number' } },
                                { title: '各带温度（℃）',
                                  align: 'center',
                                  children: [
                                      { title: '1', align: 'center', key: 'temp1', config: { type: 'number' } },
                                      { title: '2', align: 'center', key: 'temp2', config: { type: 'number' } },
                                      { title: '3', align: 'center', key: 'temp3', config: { type: 'number' } }
                                  ]
                                },
                                { title: 'H<span style="font-size:12px;font-family:YouYuan">2</span>流量<br/>（m³/h)', align: 'center', key: 'flow', config: { type: 'number' } },
                                { title: '炉膛压力<br/>（Kpa)', align: 'center', key: 'press', config: { type: 'number' } },
                                { title: ' 各带电流（A）',
                                  align: 'center',
                                  children: [
                                      { title: '1', align: 'center', key: 'electric1', config: { type: 'number' } },
                                      { title: '2', align: 'center', key: 'electric2', config: { type: 'number' } },
                                      { title: '3', align: 'center', key: 'electric3', config: { type: 'number' } }
                                  ]
                                }
                            ]
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        titlePrefix: '',
                        date: '',
                        FurnaceNo: '',
                        batchNo: '',
                        shift: '',
                        formNo: '',
                        records: [
                            {
                                time: '',
                                weight: 0,
                                speed: 0,
                                temp1: 0,
                                temp2: 0,
                                temp3: 0,
                                flow: 0,
                                press: 0,
                                electric1: 0,
                                electric2: 0,
                                electric3: 0
                            }
                        ]
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
